package cn.besbing.server.service.primary;

import cn.besbing.model.entities.primary.DlActionTable;
import cn.besbing.model.entities.primary.DlPermission;
import cn.besbing.model.mapper.primary.DlActionTableMapper;
import cn.besbing.model.utils.SearchDTO;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class PrimaryDlActionImpl {

    @Autowired(required = false)
    private DlActionTableMapper dlActionTableMapper;

    public List<DlActionTable> getAllLogAction(){
        return dlActionTableMapper.selectByExample(null);
    }

    public List<DlActionTable> getDataForTable(SearchDTO searchDTO){
        List<DlActionTable> list = new ArrayList<DlActionTable>();
        PageHelper.startPage(searchDTO.getPage(), searchDTO.getLimit(),true);
        if(searchDTO.getKeyword() != null){
            list = dlActionTableMapper.selectAction(searchDTO.getKeyword().toString());
        }else {
            list = dlActionTableMapper.selectAction(null);
            //list = permissionMapper.selectByExample(null);
        }
        return list;
    }



}
